package com.atguigu.tingshu.account.api;

import com.atguigu.tingshu.account.service.RechargeInfoService;
import com.atguigu.tingshu.common.auth.login.annotation.NeedLogin;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.vo.account.RechargeInfoVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Tag(name = "充值管理")
@RestController
@RequestMapping("api/account/rechargeInfo")
@SuppressWarnings({"unchecked", "rawtypes"})
public class RechargeInfoApiController {

	@Autowired
	private RechargeInfoService rechargeInfoService;

	// Request URL: http://localhost:8500/api/account/rechargeInfo/submitRecharge
	@PostMapping("submitRecharge")
	@Operation(summary = "余额充值")
	@NeedLogin
	public Result<Map<String, Object>> submitRecharge(@RequestBody RechargeInfoVo rechargeInfoVo) {
		Map<String, Object> map = rechargeInfoService.submitRecharge(rechargeInfoVo);
		return Result.ok(map);
	}

}

